package com.cube.truthseer.api.client;

import com.cube.truthseer.common.entity.constants.MqConstants;
import com.cube.truthseer.common.entity.dto.EmailInfoDTO;
import com.cube.truthseer.common.mq.RabbitMqHelper;
import org.springframework.stereotype.Component;


@Component
public class AsyncEmailClient {
    private final RabbitMqHelper mqHelper;

    public AsyncEmailClient(RabbitMqHelper mqHelper) {
        this.mqHelper = mqHelper;
    }

    /**
     * 基于 MQ 异步发送短信
     * @param emailInfoDTO 邮箱相关信息
     */
    public void sendMessage(EmailInfoDTO emailInfoDTO){
        mqHelper.send(MqConstants.Exchange.EMAIL_EXCHANGE, MqConstants.Key.EMAIL_MESSAGE, emailInfoDTO);
    }
}
